package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.dto.CheckMoneyDTO;
import com.woniuxy.mapper.CheckMoneyMapper;
import com.woniuxy.service.CheckMoneyService;
import com.woniuxy.service.SaasService;
import com.woniuxy.util.PageParam;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CheckMoneyServiceImpl implements CheckMoneyService , SaasService {
    @Autowired
    private CheckMoneyMapper checkMoneyMapper;
    @Override
    public ResponseData<?> queryAll(PageParam<CheckMoneyDTO> pageParam) {

        PageHelper.startPage(pageParam.getPageNum(),pageParam.getPageSize());

        List<CheckMoneyDTO> checkMoneyDTOList=checkMoneyMapper.queryAll(pageParam.getParam());
        PageInfo pageInfo =new PageInfo(checkMoneyDTOList);

        return new ResponseData<>().ok(pageInfo);
    }

    @Override
    public ResponseData<?> queryByCkNo(String ckNo) {
        CheckMoneyDTO checkMoneyDTO = checkMoneyMapper.queryCkNo(ckNo);
        return new ResponseData<>().ok(checkMoneyDTO);
    }
}
